Calling meta_window_get_monitor on an unmanaged window may return
-1, so we need to check the return value.
https://bugzilla.gnome.org/show_bug.cgi?id=788882
let screen = global.screen;
let nMonitors = screen.get_n_monitors();
- if (nMonitors > 1) {
+ let monitorIndex = window.get_monitor();
+ if (nMonitors > 1 && monitorIndex >= 0) {
this.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
- let monitorIndex = window.get_monitor();
-
let dir = Meta.ScreenDirection.UP;
let upMonitorIndex =
screen.get_monitor_neighbor_index(monitorIndex, dir);